package com.hand.cloud.controller;

import com.hand.cloud.entity.User;
import com.hand.cloud.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;


    @GetMapping("get/{id}")
    public User queryOne(@PathVariable("id") Integer id) {
        return userService.queryOne(id);
    }

    @GetMapping("queryAll")
    public List<User> queryAll() {

        return userService.queryAll();
    }

    @PostMapping("addUser")
    public int addUser(@RequestBody User user) {
        return userService.addUser(user);
    }

}
